<style type="text/css">
    #compl02 {
        margin-bottom: 20px;
        font-family: Verdana;
        background-color: #FFFFFF;
    }
    #compl02 .mc {
        padding: 10px;
    }
    #compl02 .mc dl.fore {
        border-top: medium none;
        margin-top: 0;
        padding-top: 0;
    }
    #compl02 .mc dl {
        border-top: 1px dotted #E7E7E7;
    }
    #compl02 dl {
        margin-top: 8px;
        padding-top: 8px;
    }
    #compl02 .mc dt {
        margin-bottom: 5px;
    }
    .fl {
        float: left;
    }
    #compl02 dl .fore1 {
        margin-left: 66px;
    }
    #compl02 dl .fl {
        text-align: right;
    }
    .fl {
        float: left;
    }
    #compl02 .mc dl {
        border-top: 1px dotted #E7E7E7;
    }
    #compl02 dl {
        margin-top: 8px;
        padding-top: 8px;
    }
    #compl02 .mc dt {
        margin-bottom: 5px;
    }
    #compl02 .mc dd {
        color: #9A9A9A;
        margin-bottom: 5px;
    }
    .m1 {
        border: 1px solid #E6E6E6;
        margin-top: -1px;
        z-index: -1;
    }
    .m, .sm {
        margin-bottom: 10px;
    }
    .m, .mt, .mc, .mb, .sm, .smt, .smc, .smb {
        overflow: hidden;
    }
    #compl02 .mt {
        padding-left: 10px;
    }
    .m1 .mt {
        background: url("/images/tb-th.2011.gif") repeat-x scroll 0 -31px transparent;
        border-bottom: 1px solid #E6E6E6;
        height: 34px;
        line-height: 34px;
        padding-left: 16px;
    }
    .mt, .smt {
        cursor: default;
    }
    .m, .mt, .mc, .mb, .sm, .smt, .smc, .smb {
        overflow: hidden;
    }
    #compl02 .mt h3 {
        font-size: 12px;
    }
    .m1 .mt h3 {
        float: left;
    }

    .list-view .items {
        font-size: 12px;
        padding: 0;
        width: auto;
    }</style>

<?php
if(empty(YII::app()->user->id)){
    throw new CHttpException(400,'请先登录.');
}
$id=Yii::app()->request->getParam('id', 0);
$topmsg=Message::model()->with(array('post_user','to_user'))->findByPk($id);
if(empty($topmsg)){
    $this->renderPartial('//site/error',array(
        'message'=>'此项隐藏功能,请从站内消息进入',
        'direct'=>$this->createUrl('manage/index',array('cate'=>9)),
    ));
    return;
}

$criteria=new CDbCriteria;
$criteria->condition='`t`.`status` > -1 AND `t`.`pid` = :pid AND `t`.`open`=1 AND `t`.`view`=1 AND (`t`.`post_uid`=:post_uid OR `t`.`to_uid`=:to_uid)';
$criteria->with=array('post_user','to_user');
$criteria->params=array(':post_uid'=>YII::app()->user->id, ':to_uid'=>YII::app()->user->id, ':pid'=>$id);
$criteria->order="`t`.`time` ASC";

$dataProvider=new CActiveDataProvider('Message',array(
    'criteria'=>$criteria,
    'pagination'=>array(
        'pageSize'=>20,
    ),
));

$session=new CHttpSession();
$session->open();
$session['i']=1;
?>


    <div id="compl02" class="m m1">
        <?php if(!empty($topmsg)): ?>
        <div class="mt"><h3><?php echo $topmsg->title; ?></h3></div>
        <div class="mc">

        <dl class="fore">
            <dt><strong class="fl"><?php echo $topmsg->post_user->nickname;?>：</strong><div class="fore1"><?php echo $topmsg->content;?></div></dt>
            <dd><strong class="fl">提交时间：</strong><div class="fore1"><?php echo $topmsg->time;?></div></dd>
        </dl>
        <?php endif;?>
<?php
if(!empty($dataProvider->data))
    $this->widget('zii.widgets.CListView', array(
        'dataProvider'=>$dataProvider,
        'itemView'=>'_viewmsg',
        'ajaxUpdate'=>false,
        'template'=>"{items}\n{pager}",
//        'itemsTagName'=>'ul',
//        'itemsCssClass'=>'tb',
    ));
?>         <div class="fore">&nbsp;</div>
            <form action="/index.php?r=manage/repmsg" method="post">
                <span>提交新的留言:</span><br />
                <textarea name="content" style="height: 110px;width: 650px;"></textarea>
                <input type="hidden" name="pid" value="<?php echo $id;?>" />
                <input type="submit" value="回复" style="margin-top: 5px;float: right;">
            </form>
    </div>
</div>

